package offer;

public class EX10 {
    public int fib(int n) {
        long result[] = {0,1};
        if(n<=1){
            return (int)result[n];
        }
        for(int i = 2;i<=n;i++){
            long res = (result[0]+result[1])%1000000007;
            result[0] = result[1];
            result[1] = res;
        }
        return (int)result[1];
    }
}
